package demo8;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@PropertySource(value = "classpath:/user.properties",encoding = "utf-8")

public class Dept {
    //取值方式："${dept.id}"
    @Value("${user.id}")
    private int id;
    @Value("${user.name}")
    private String name;
    public void hello(){
        System.out.println("id:"+id+"\\t"+"name:"+name);
    }
}
